package com.lh.java.structure;

public class Queue {
	  private class Node {
		    Object item; Node next;
		    Node ( Object item ) {
		      this.item = item; this.next = null;
		    }
		  }
		  private Node head, tail;
		  Queue ( Object max ) { head = null; tail = null; }
		  boolean isEmpty() { return ( head ==null ); }
		  void put ( Object item ) {
		    Node t = tail;
		    tail = new Node(item);
		    if (isEmpty())
		      head = tail;
		    else t.next = tail;
		  }
		  Object get() {
		    Object v = head.item;
		    Node t = head.next;
		    head = t;
		    return v;
		  }
}
